#pragma once

#include "../Gui.h"
#include "../Control/BatCtrl.h"
#include "../Control/TimeCtrl.h"
#include "../Control/Text.h"
#include "../Control/Progress.h"
#include "../Control/BmpBtn.h"
#include "../Control/BmpAnimateCtrl.h"
#include "../Control/BatCtrl.h"
#include "../Control/Picture.h"
#include "XMLParser.h"

typedef struct TABINFO
{
	wstring m_strPara;;
	wstring m_strData;
}TabInfo;

class GUI_API BtnParam
{
public:
	BtnParam(){}
	~BtnParam(){}

public:

	wstring m_strImg;
	CRect   m_rc;
	COLORREF m_clrTxtNormal;
	COLORREF m_clrTxtActive;
	CSize    m_szTxtOffset;
	BOOL     m_bTranparent;
	COLORREF m_clrTranparent;
	DWORD    m_dwAlign;
	int      m_nImgNum;
	wstring  m_strFont;
};

class GUI_API TextParam
{
public:
	TextParam(){}
	~TextParam(){}

public:
	CRect		m_rc;
	COLORREF	m_clrText;
	COLORREF	m_clrGrow;
	DWORD		m_dwAlign;
	wstring		m_strFont;
	wstring		m_strLangKey;

};

class GUI_API BatTimePicParam
{
public:
	BatTimePicParam(){}
	~BatTimePicParam(){}

public:
	wstring   m_strImg;
	CRect	  m_rc;
	BOOL     m_bTranparent;
	COLORREF  m_clrTranparent;
};

class GUI_API ProgressParam
{
public:
	ProgressParam(){}
	~ProgressParam(){}

public:
	wstring		m_strChanelNormal;
	wstring		m_strChanelActive;
	wstring		m_strThumbNormal;
	wstring		m_strThumbActive;
	CRect		m_rc;
	CSize		m_szMargin;
	BOOL		m_bTranparent;
	COLORREF	m_clrTranparent;	
	BOOL       m_bVer;
	BOOL		m_bEnable;
};

class GUI_API ListParam
{
public:
	ListParam(){}
	~ListParam(){}

public:
	CRect		m_rc;
	COLORREF	m_clrTxtNormal;
	COLORREF	m_clrTxtActive;
	DWORD		m_dwAlign;
	int			m_nItemHight;
	DWORD		m_dwStyle;
	wstring		m_strImg;
	wstring		m_strSelItem;
	BOOL		m_bTranparent;
	COLORREF	m_clrTranparent;
	COLORREF	m_clrLineStart;
	COLORREF	m_clrLineEnd;
	CSize		m_szIcon;
	wstring		m_strFont;
};

class GUI_API CResConfig
{
public:
	CResConfig(void);
	virtual ~CResConfig(void);

public:
	BOOL InitFromFile(wstring strFile);
	BOOL Init(wstring strFile);
	BOOL GetBtnParam(BtnParam &btnInfo,wstring strkey);
	BOOL GetTextParam(TextParam &txtInfo,wstring strKey);
	BOOL GetBatTimePicParam(BatTimePicParam &battimeInfo,wstring strKey);
	BOOL GetProgreeParam(ProgressParam &progressInfo,wstring strKey);
	BOOL GetListParam(ListParam &listParam,wstring strKey);

	wstring GetAttribData(wstring strKey,wstring strAttrib);
	BOOL GetVectorData(wstring strKey,vector<wstring> &vString);
	BOOL GetTabInfo(wstring strKey,vector<TabInfo> &m_vLan);

	void SetBtnParam(CBmpBtn *pBmpBtn,BtnParam &btnInfo);
	void SetTextParam(CText *pText,TextParam &txtInfo);
	void SetBatParam(CBatCtrl *pBatCtrl,BatTimePicParam &battimeInfo);
	void SetTimeParam(CTimeCtrl *pTimeCtrl,BatTimePicParam &battimeInfo);
	void SetPicParam(CPicture *pPicture,BatTimePicParam &picInfo);
	void SetProgressParam(CProgress *pProCtrl,ProgressParam &proInfo);

	int GetAniType();
	int GetExitAniType();
	int GetAniSpeed();

	CRect	GetRect();
	wstring GetName();
	wstring GetImage();
	BOOL	IsResFromDll();

public:
	CRect		GetRectFromString(wstring strRect);
	COLORREF	GetColorFromString(wstring strColor);
	CSize		GetSizeFormString(wstring strSize);
	BOOL		Token(wstring &strInput,TCHAR* pStep,vector<wstring>& vRet);

public:
	BOOL		m_bFromDll;
	wstring		m_strResPath;

protected:
	CXMLParser m_xml;

};